//配置路由的地方
import Vue from "vue"
import vueRouter from 'vue-router'
//使用插件
Vue.use(vueRouter)
import Home from '@/pages/Home/home.vue'
import Login from '@/pages/Login/login.vue'
import Search from '@/pages/Search/search.vue'
import Resiger from '@/pages/Register/register.vue'
let originPush=vueRouter.prototype.push//重写push 多次点击报错的问题，返回值为promise
vueRouter.prototype.push=function(location,resolve,reject){
  if(resolve&&reject){
      originPush.call(this,location,reject,resolve)//用户有用自己的
  }
  else{
      originPush.call(this,location,()=>{},()=>{})//用户没有给他配
  }
}
//配置路由
export default new vueRouter({
    routes:[
        {
            path:"/",
            redirect:"/home",//项目重定向
        },
        {
            path:"/home",
            component:Home,
            meta:{"show":true}
        },
        {
            path:"/login",
            component:Login,
            meta:{"show":false}
        },
        {
            name:"search", //对象传参通过name进行
            path:"/search/:keyValue1?",
            component:Search,
            meta:{"show":true}
        },
        {
            path:"/resiger",
            component:Resiger,
            meta:{"show":false}

        },

    ]
})